# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=idris2-stage0
pkgver=0.6.0
pkgrel=2
pkgdesc="Idris 2 version used to bootstrap the Idris 2 compiler"
url="https://www.idris-lang.org"
arch="x86 x86_64" # limited by chez-scheme
license="BSD-3-Clause"
depends="chez-scheme gmp-dev"
makedepends="bash"
source="https://github.com/idris-lang/Idris2/archive/v$pkgver/idris2-$pkgver.tar.gz"
builddir="$srcdir/Idris2-$pkgver"

# Provide idris2-bootstrap for testing/idris2.
# See the comment in testing/idris2 for more information.
provides="idris2-bootstrap=$pkgver"
provider_priority=1 # lowest

case "$CARCH" in
x86) options="!check" ;; # XXX: https://github.com/idris-lang/Idris2/issues/1617
esac

build() {
	# Bootstrap Idris 2 compiler from scheme sources.
	make -j1 bootstrap PREFIX=/usr SCHEME=chez
}

check() {
	make -j1 bootstrap-test
}

package() {
	# Idris2 Makefile doesn't honor $DESTDIR
	# See https://github.com/idris-lang/Idris2/pull/1123
	make IDRIS2_PREFIX="$pkgdir/usr" \
		PREFIX="$pkgdir/usr" install
}

sha512sums="
342ab3d9e38c8150c7eec997e9cbadd4aa12ccb18994b6b008f165deb20fd5fc79f4944387316cbba03e56fa1545b0afbb277988449af5b21d20f81207f6f367  idris2-0.6.0.tar.gz
"
